package com.jh.user.business;

import java.util.Date;
import java.util.List;
import java.util.Map;

import cn.jh.common.exception.ServiceException;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import com.jh.user.pojo.JdpushHistory;
import com.jh.user.pojo.Resource;
import com.jh.user.pojo.Role;
import com.jh.user.pojo.RoleResource;
import com.jh.user.pojo.RoleResourceForm;
import com.jh.user.pojo.User;
import com.jh.user.pojo.UserRole;

public interface UserRoleResourceBusiness {

	/*
	 * 权限管理
	 */
	public  Resource saveResource(Resource resource);

	public void updateResource(long id,String resourceNo,String resourceName,String url);

	public Page<Resource> findAllResource(String resourceNo,String resourceName,String url,Pageable pageable);

	public List<Resource> findAllResource(long id);

	public void delResourceById(long resourceNo);

	/*
	 * 角色权限管理
	 */
	public RoleResource saveRoleResource(RoleResource roleResource);

	public Page<RoleResource> findAllRoleResourcePage( long roleid ,  long resourceid,Pageable pageable);

	public Page<RoleResourceForm> findAllResourcePageBYRole(long roleid ,  long resourceid,Pageable pageable);

	public void delRoleResource(long roleid,long resourceid);

	public void upRoleResource(long roleid,long resourceid,long resourceno);

	/*
	 * 角色管理
	 */
	public Page<Role> rolepage(String rolecode,String rolename,Pageable pageable);

	public List<Role> findAllRole();

	public List<Role> findAllRole(long id);

	public Role addrole(Role role);

	public void updateRole(long id,String rolename,String rolecode);

	public void delRole(long id);

	public Role findById(long id);

	/*
	 * 用户角色管理
	 */
	public UserRole adduserRole(UserRole role);

	public int newUpdate(long oldUserId,long oldRoleId,long roleId,long brandId,long certigieruserId,String status,Date creatTime);

	public Page<UserRole> UserRolepage(long userId,long roleId,Pageable pageable);

	public Page<Object> UserRolepageByuserId(long userId,long roleId,Pageable pageable,String phone);

	public UserRole UserRolepageByRUid(long userId);

	public void upuserRole(long userId,long roleId);

	public void delUserRole(long userId);

	public UserRole findByUserIdAndStatus(long userid,String status);

	public UserRole findByUserIdAndRoleIdAndStatus(long userId,long roleId,String status);

	/**
	 * 用户权限管理
	 *
	 * */
	public List<User> findAllUser(long id);

	public List<Resource>  findUserResourceByuserId(long userId);



	/***
	 * 推送管理
	 * */
	/**
	 * 推送添加
	 * **/
	public JdpushHistory addJdpushHistory(JdpushHistory jdh);

	/**
	 * 个人推送查询
	 * */
	public Page<JdpushHistory> findJdpushHistoryByuserId(long userId ,Pageable pageable);

	/***
	 * 推送删除
	 * **/
	public void delJdpushHistoryByuserId(long userId,long brandId,String type);

	//通过id删除推送
	public void delJdpushHistoryById(long id);
	/**
	 * 查询平台推送
	 *
	 * */
	public Page<JdpushHistory> findJdpushHistoryByBrandId(long brandId,Pageable pageable);

	public void delJdpushHistoryByUid(long userid,long brandid);

	//查询当前权限下所有直推用户信息
	public List<UserRole> findUserRoleByRoleid(Long[] usersid, long roleid);

    Map<String, Object> queryUserRole(long userId) throws ServiceException;

    String queryUserIds(long userId) throws ServiceException;
}
